home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 29
/
Volume 29 - JOGO DISK .iso
/
Games
/
jungle_adventure.swf
/
scripts
/
__Packages
/
GDK
/
Collection.as
< prev
next >
Wrap
Text File
|
2006-11-29
|
2KB
|
84 lines
class GDK.Collection extends Array
{
static var Collections = [];
static var created = 0;
function Collection()
{
super();
GDK.Collection.Collections[this.id = ++GDK.Collection.created] = this;
}
static function removeFromAll(obj)
{
var _loc1_ = undefined;
if(!(_loc1_ = obj.__col))
{
return undefined;
}
for(var _loc3_ in _loc1_)
{
GDK.Collection.Collections[_loc3_].removeMember(obj);
}
}
static function removeAll()
{
}
function addMember(obj)
{
if(obj.__col[this.id])
{
return false;
}
this.push(obj);
if(!obj.__col)
{
obj.__col = {count:0};
}
obj.__col[this.id] = true;
obj.__col.count = obj.__col.count + 1;
return true;
}
function removeMember(obj)
{
if(!obj.__col[this.id])
{
return false;
}
var _loc2_ = this.length;
while((_loc2_ = _loc2_ - 1) > -1)
{
if(this[_loc2_] == obj)
{
this.splice(_loc2_,1);
break;
}
}
if(!--obj.__col.count)
{
delete obj.__col;
}
else
{
delete obj.__col[this.id];
}
delete this[this.length];
return true;
}
function update(elapsed)
{
var _loc2_ = this.length;
while((_loc2_ = _loc2_ - 1) > -1)
{
this[_loc2_].update(elapsed);
}
}
function send(sID)
{
var _loc4_ = arguments.slice(1);
var _loc3_ = this.length;
while((_loc3_ = _loc3_ - 1) > -1)
{
this[_loc3_][sID].apply(this[_loc3_],_loc4_);
}
}
}